package com.lzx.adx.report.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lzs.adx.commmon.service.impl.CrudServiceImpl;
import com.lzx.adx.report.dao.UserLinkerDao;
import com.lzx.adx.report.dto.UserLinkerDTO;
import com.lzx.adx.report.entity.UserLinkerEntity;
import com.lzx.adx.report.service.UserLinkerService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.Objects;

/**
 * 配置用户自己的链接
 *
 * @author wangzhijun 825400558@qq.com
 * @since 1.0.0 2025-08-07
 */
@Service
public class UserLinkerServiceImpl extends CrudServiceImpl<UserLinkerDao, UserLinkerEntity, UserLinkerDTO> implements UserLinkerService {

    @Override
    public QueryWrapper<UserLinkerEntity> getWrapper(Map<String, Object> params){
        Long id = (Long)params.get("id");
        Long userId = (Long)params.get("userId");
        Integer type = (Integer)params.get("type");

        QueryWrapper<UserLinkerEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(Objects.nonNull(id), "id", id);
        wrapper.eq(Objects.nonNull(userId), "user_id", userId);
        wrapper.eq(Objects.nonNull(type), "type", type);

        return wrapper;
    }


}